# 基础镜像使用JAVA
# FROM openjdk:8-alpine
FROM openjdk:17-alpine
# 设置国内源
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# 配置时区
RUN apk update && apk --no-cache add tzdata  \
    && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone
# 定义参数。即：可以获取pom.xml文件中，dockerfile-maven-plugin插件定义的参数
ARG JAR_FILE
# 设置工作目录
WORKDIR /opt
# 复制本地的Jar文件到容器内
COPY ./target/${JAR_FILE} /opt/app.jar
# 暴露容器内的端口到宿主机
# EXPOSE 8080
# 运行Java应用
# ENTRYPOINT ["java", "-Dfile.encoding=utf-8", "-jar","app.jar", "--spring.config.location=classpath:/opt/bootstrap.yml"]
ENTRYPOINT ["java","-jar","/opt/app.jar"]